package xing.test.jingle;

import java.util.ArrayList;
import java.util.List;

import org.jivesoftware.smack.XMPPConnection;
import org.jivesoftware.smackx.jingle.JingleManager;
import org.jivesoftware.smackx.jingle.JingleSession;
import org.jivesoftware.smackx.jingle.media.JingleMediaManager;
import org.jivesoftware.smackx.jingle.mediaimpl.jmf.JmfMediaManager;
import org.jivesoftware.smackx.jingle.mediaimpl.jspeex.SpeexMediaManager;
import org.jivesoftware.smackx.jingle.mediaimpl.testxing.TestXingMediaManager;
import org.jivesoftware.smackx.jingle.nat.BasicTransportManager;

public class JIngleSender {
	public static void main(String[] args) {
		try {
			XMPPConnection.DEBUG_ENABLED = true;
			XMPPConnection x1 = new XMPPConnection("10.10.9.104");

			x1.connect();
			x1.login("xing", "xing");

			BasicTransportManager icetm0 = new BasicTransportManager();
			List<JingleMediaManager> mediaManagers = new ArrayList<JingleMediaManager>();
			// mediaManagers.add(new JmfMediaManager(icetm0));
			mediaManagers.add(new TestXingMediaManager(icetm0));
			// mediaManagers.add(new ScreenShareMediaManager(icetm0));
			JingleManager jm = new JingleManager(x1, mediaManagers);
			JingleManager.setJingleServiceEnabled();
			// Create a new Jingle Call with a full JID
			JingleSession js0 = jm
					.createOutgoingJingleSession("jtest@xing-system/Smack");

			// Start the call
			js0.startOutgoing();

			Thread.sleep(100000);
			// js0.terminate();

		} catch (Exception e) {
			e.printStackTrace();
		}
	}
}
